﻿@model List<S4Store.Domain.AfterSaleKpi.DeadStock>
@{
    ViewBag.Title = "MonthConfig";
    Layout = null;
    S4Store.Domain.Administrator CurrentUser = (S4Store.Domain.Administrator)ViewBag.CurrentUser;
}
@{int i = 0;}
<form class="pageForm addpage" action="@Url.Action("ModifyDeadStockMonthInput")" method="post">
<div style="height: 100%; width: 100%; overflow: hidden" class="verticalSplitContainer">
    <div class="pageFormContent" style="overflow: auto;" ratio="*">
        <table>
            <tr>
                

                <td  valign="top">
                


                <table class="reporttable" id="sj1" style="border-collapse: collapse;">
            <tr >
                <th class="inputedheader" style=" height:108px;">
                    <div>
                        呆滞备件名称</div>
                </th>
                <th class="inputedheader">
                    <div>
                        呆滞备件编码</div>
                </th>
                <th class="inputedheader">
                    <div>
                       呆滞备件数量</div>
                </th>
                <th class="inputedheader">
                    <div>
                        呆滞库存备件成本</div>
                </th>
            </tr>
            @{
                //var dz = Model.Where(o=>o.Cla==0);
                    
            }

            @foreach (var item in Model.Where(o => o.Cla == 0))
            {
                <tr>
                    <td>
                        <input type="text" class="textInput" style="width:200px" name="afterSaleCarlist[@i].WTPJMC" value="@item.WTPJMC" />
                    </td>
                    <td>
                        <input type="text" class="textInput" style="width:120px" name="afterSaleCarlist[@i].DZBJBM" value="@item.DZBJBM" />
                    </td>
                    <td>
                        <input type="text" class="textInput numberinput" style="width:40px" name="afterSaleCarlist[@i].DZBJSL" value="@item.DZBJSL" />
                    </td>
                    <td>
                        <input type="text" class="textInput numberinput" style="width:40px" name="afterSaleCarlist[@i].DZKUBJCB" value="@item.DZKUBJCB" /> <input type="hidden" name="afterSaleCarlist[@i].Cla" value="0" />
                    </td>
                </tr>
               i++;
            }
            
        </table>
        <br/>
        <a href="javascript:;" title="添加一行" id="addtr1">+ 添加一行</a> &nbsp;&nbsp;&nbsp;&nbsp; <a href="javascript:;" title="删去一行" id="removetr1">- 删去一行</a>
                
                
                
                </td>

                <td valign="top">
                    <table class="reporttable" id="sj" style="border-collapse: collapse;">
            <tr>
                <th class="inputedheader" style=" height:108px;">
                    <div>
                        死库配件名称</div>
                </th>
                <th class="inputedheader">
                    <div>
                        死库备件编码</div>
                </th>
                <th class="inputedheader">
                    <div>
                       死库备件数量</div>
                </th>
                <th class="inputedheader">
                    <div>
                        死库备件成本</div>
                </th>
            </tr>
            @foreach (var item in Model.Where(o=>o.Cla==1))
            {
                <tr>
                    <td>
                        <input type="text" class="textInput" style="width:200px" name="afterSaleCarlist[@i].WTPJMC" value="@item.WTPJMC" />
                    </td>
                    <td>
                        <input type="text" class="textInput" style="width:120px" name="afterSaleCarlist[@i].SKBJBM" value="@item.SKBJBM" />
                    </td>
                    <td>
                        <input type="text" class="textInput numberinput" style="width:40px" name="afterSaleCarlist[@i].SKBJSL" value="@item.SKBJSL" />
                    </td>
                    <td>
                        <input type="text" class="textInput numberinput" style="width:40px" name="afterSaleCarlist[@i].SKBJCB" value="@item.SKBJCB" />
                        <input type="hidden" name="afterSaleCarlist[@i].Cla" value="1" />
                    </td>
                </tr>
               i++;
            }
        </table>
        <br/>
        <a href="javascript:;" title="添加一行" id="addtr">+ 添加一行</a> &nbsp;&nbsp;&nbsp;&nbsp; <a href="javascript:;" title="删去一行" id="removetr">- 删去一行</a>
                </td>
            </tr>
        </table>
        
    </div>
    <script type="text/javascript">
        $(function () {

            function AddOrRemoveCallback() {
                $("#sj tr:not(:first),#sj1 tr:not(:first)").each(function (i) {
                    $(this).find("input").each(function () {
                        var $thisinput = $(this);
                        $thisinput.attr("name", $thisinput.attr("name").replace(/\d+/g, i));
                    });
                });
            }

            $("#addtr").click(function () {
                var $tr = $("#sj tr:last").clone();
                $tr.appendTo($("#sj"));
                AddOrRemoveCallback();
            });
            $("#removetr").click(function () {
                if ($("#sj tr").size() > 2) {
                    $("#sj tr:last").remove();
                    AddOrRemoveCallback();
                }
            });

            $("#addtr1").click(function () {
                var $tr = $("#sj1 tr:last").clone();
                $tr.appendTo($("#sj1"));
                AddOrRemoveCallback();
            });
            $("#removetr1").click(function () {
                if ($("#sj1 tr").size() > 2) {
                    $("#sj1 tr:last").remove();
                    AddOrRemoveCallback();
                }
            });

        });
</script>
    <input type="hidden" name="y" value="@ViewBag.Date.Year" /> <input type="hidden" name="m" value="@ViewBag.Date.Month" />
        <div class="formBar" ratio="#30">
@*    @if (!Model.isconfirmed)
    {
*@        <ul>
            <li>
                <div class="simplebutton">
                    <div class="r">
                        <button type="button" class="submit">
                            保存</button></div>
                </div>
            </li>
            <li>确认数据：<input type="checkbox" name="isconfirm" value="true" /></li>
        </ul>
@*    }
*@    </div>
</div>
</form>
